import { apiClient } from 'axiom-view';

/**
 * 获取权限树
 * @returns {Promise<any>}
 */
export function getPermissionTree() {
  return apiClient.get('/system/permissions/tree');
}

/**
 * 新增权限
 * @param {object} data - 权限数据
 * @returns {Promise<any>}
 */
export function createPermission(data) {
  return apiClient.post('/system/permissions', data);
}

/**
 * 更新权限
 * @param {number|string} id - 权限ID
 * @param {object} data - 权限数据
 * @returns {Promise<any>}
 */
export function updatePermission(id, data) {
  return apiClient.put(`/system/permissions/${id}`, data);
}

/**
 * 删除权限
 * @param {number|string} id - 权限ID
 * @returns {Promise<any>}
 */
export function deletePermission(id) {
  return apiClient.delete(`/system/permissions/${id}`);
}

/**
 * 启用权限
 * @param {string} permissionId - 权限ID
 * @returns {Promise<any>}
 */
export function enablePermission(permissionId) {
  return apiClient.put(`/system/permissions/${permissionId}/enable`);
}

/**
 * 禁用权限
 * @param {string} permissionId - 权限ID
 * @returns {Promise<any>}
 */
export function disablePermission(permissionId) {
  return apiClient.put(`/system/permissions/${permissionId}/disable`);
} 